//
//  YYJLMonthlyTestCell.m
//  YuanyangJinlou
//
//  Created by mac004 on 2017/1/9.
//  Copyright © 2017年 suli19910309@qq.com. All rights reserved.
//

#import "YYJLMonthlyTestCell.h"
@interface YYJLMonthlyTestCell()
{
    UILabel     * tipLb;//提示是否参加考试
    UILabel     * titleLb;//考试名称
    UILabel     * particularLb;//具体情况
    UIImageView * showPic;
}
@end
@implementation YYJLMonthlyTestCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
    }
    return self;
}
-(void)creatUI{
    UIImage * image =[UIImage imageNamed:@"bg_kaoshi"];//355*125
    UIImageView * bgView=[[UIImageView alloc]initWithFrame:CGRectMake(10*PER_WIDTH, 0, 355*PER_WIDTH, 125*PER_HEIGHT)];
    bgView.image=image;
    [self.contentView addSubview:bgView];
    
    //图片区
     showPic =[[UIImageView alloc]initWithFrame:CGRectMake(10*PER_WIDTH, 10*PER_HEIGHT, 150*PER_WIDTH, 100*PER_HEIGHT)];
    showPic.image=[UIImage imageNamed:@"img_yuekao"];
    showPic.layer.masksToBounds = YES;
    [bgView addSubview:showPic];
    
    
    UIView * view=[[UIView alloc]initWithFrame:CGRectMake(-15*PER_WIDTH, 0, 74*PER_WIDTH, 30*PER_HEIGHT)];
    view.backgroundColor=[UIColorFromHex(0x000000) colorWithAlphaComponent:.3];
    view.layer.cornerRadius=view.height/2;
    view.layer.masksToBounds=YES;
    view.clipsToBounds=YES;
    [showPic addSubview:view];
    
    tipLb=[MyControl createLabelWithFrame:CGRectMake(0, 0, 59*PER_WIDTH, 30*PER_HEIGHT) Font:13 Text:@"已考" Color:WHITE_COLOR];
    tipLb.textAlignment=NSTextAlignmentCenter;
  //  tipLb.layer.cornerRadius=tipLb.height/2;
//    UIBezierPath *bezierPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(44*PER_WIDTH, 15*PER_HEIGHT) radius:270*PERCEN startAngle:-M_PI_2 endAngle:M_PI_2 clockwise:YES];
//    CAShapeLayer *bgLayer = [CAShapeLayer layer];
//    bgLayer.frame = CGRectMake(0, 0, 59*PER_WIDTH, 30*PER_HEIGHT);
//    bgLayer.backgroundColor = [UIColor clearColor].CGColor;
//    bgLayer.path = bezierPath.CGPath;
//    bgLayer.fillColor = [UIColor clearColor].CGColor;
//    bgLayer.strokeColor = RGBColor(114, 118, 125).CGColor;
//    //bgLayer.lineWidth = 20*PERCEN;
//    bgLayer.lineJoin = kCALineJoinRound;
//    bgLayer.lineCap = kCALineCapRound;
//    [showPic.layer addSublayer:bgLayer];
    
    
    
    [showPic addSubview:tipLb];
    
    titleLb=[MyControl createLabelWithFrame:CGRectMake(showPic.right+10*PER_WIDTH, 10*PER_HEIGHT, 150*PER_WIDTH, 15*PER_HEIGHT) Font:15 Text:@"2016年12月考试试题" Color:BLACK_COLOR];
    [bgView addSubview:titleLb];
    
    UIImage * tipImg=[UIImage imageNamed:@"ico_tishi"];
    UIImageView * tip =[[UIImageView alloc]initWithFrame:CGRectMake(showPic.right+12*PER_WIDTH, titleLb.bottom+15*PER_HEIGHT, tipImg.size.width*PER_WIDTH, tipImg.size.width*PER_WIDTH)];
    tip.image=tipImg;
    [bgView addSubview:tip];
    
    particularLb=[MyControl createLabelWithFrame:CGRectMake(tip.right+5*PER_WIDTH, titleLb.bottom+15*PER_HEIGHT, titleLb.width, 12*PER_HEIGHT) Font:12 Text:@"共10道题,满分100分" Color:FEELT_COLOR];
    [bgView addSubview:particularLb];
    
    UILabel * lab =[MyControl createLabelWithFrame:CGRectMake(particularLb.left, particularLb.bottom+10*PER_HEIGHT, particularLb.width, 12*PER_HEIGHT) Font:12 Text:@"仅一次考试机会" Color:FEELT_COLOR];
    [bgView addSubview:lab];
    
}
-(void)setIsMonthly:(BOOL)isMonthly{
    _isMonthly=isMonthly;
    if (isMonthly) {
        showPic.image=[UIImage imageNamed:@"img_yuekao"];
    }
}
-(void)setIsPersonal:(BOOL)isPersonal{
    _isPersonal=isPersonal;
    if (isPersonal) {
          showPic.image=[UIImage imageNamed:@"img_zhuanye"];
    }else{
          showPic.image=[UIImage imageNamed:@"img_moni"];
    }
}
@end
